home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / amigaunits / rexx.pas < prev    next >
Pascal/Delphi Source File  |  2000-01-01  |  23KB  |  662 lines

  1. {
  2.     This file is part of the Free Pascal run time library.
  3.  
  4.     A file in Amiga system run time library.
  5.     Copyright (c) 1998-2000 by Nils Sjoholm
  6.     member of the Amiga RTL development team.
  7.  
  8.     See the file COPYING.FPC, included in this distribution,
  9.     for details about the copyright.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14.  
  15.  **********************************************************************}
  16. {
  17.     History:
  18.     Added overlay functions for Pchar->Strings, functions
  19.     and procedures.
  20.  
  21.     14 Jul 2000.
  22.     nils.sjoholm@mailbox.swipnet.se
  23. }
  24.  
  25. UNIT rexx;
  26.  
  27. INTERFACE
  28.  
  29. {$I amigaoverlays.inc}
  30.  
  31. USES exec;
  32.  
  33.  
  34.  
  35. { === rexx/storage.h ==================================================
  36.  *
  37.  * Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
  38.  *
  39.  * =====================================================================
  40.  * Header file to define ARexx data structures.
  41. }
  42.  
  43.  
  44. { The NexxStr structure is used to maintain the internal strings in REXX.
  45.  * It includes the buffer area for the string and associated attributes.
  46.  * This is actually a variable-length structure; it is allocated for a
  47.  * specific length string, and the length is never modified thereafter
  48.  * (since it's used for recycling).
  49.  }
  50.  
  51. Type
  52.  
  53.     pNexxStr = ^tNexxStr;
  54.     tNexxStr = record
  55.     ns_Ivalue   : Longint;  { integer value                 }
  56.     ns_Length   : Word;     { length in bytes (excl null)   }
  57.     ns_Flags    : Byte;     { attribute flags               }
  58.     ns_Hash     : Byte;     { hash code                     }
  59.     ns_Buff     : Array [0..7] of Byte;
  60.                     { buffer area for strings       }
  61.     end;                { size: 16 bytes (minimum)      }
  62.  
  63. Const
  64.  
  65.     NXADDLEN    = 9;            { offset plus null byte         }
  66.  
  67. { String attribute flag bit definitions                                }
  68.  
  69.     NSB_KEEP    = 0;            { permanent string?             }
  70.     NSB_STRING  = 1;            { string form valid?            }
  71.     NSB_NOTNUM  = 2;            { non-numeric?                  }
  72.     NSB_NUMBER  = 3;            { a valid number?               }
  73.     NSB_BINARY  = 4;            { integer value saved?          }
  74.     NSB_FLOAT   = 5;            { floating point format?        }
  75.     NSB_EXT = 6;            { an external string?           }
  76.     NSB_SOURCE  = 7;            { part of the program source?   }
  77.  
  78. { The flag form of the string attributes                               }
  79.  
  80.     NSF_KEEP    = 1;
  81.     NSF_STRING  = 2;
  82.     NSF_NOTNUM  = 4;
  83.     NSF_NUMBER  = 8;
  84.     NSF_BINARY  = 16;
  85.     NSF_FLOAT   = 32;
  86.     NSF_EXT = 64;
  87.     NSF_SOURCE  = 128;
  88.  
  89. { Combinations of flags                                                }
  90.  
  91.     NSF_INTNUM  = NSF_NUMBER + NSF_BINARY + NSF_STRING;
  92.     NSF_DPNUM   = NSF_NUMBER + NSF_FLOAT;
  93.     NSF_ALPHA   = NSF_NOTNUM + NSF_STRING;
  94.     NSF_OWNED   = NSF_SOURCE + NSF_EXT    + NSF_KEEP;
  95.     KEEPSTR = NSF_STRING + NSF_SOURCE + NSF_NOTNUM;
  96.     KEEPNUM = NSF_STRING + NSF_SOURCE + NSF_NUMBER + NSF_BINARY;
  97.  
  98. { The RexxArg structure is identical to the NexxStr structure, but
  99.  * is allocated from system memory rather than from internal storage.
  100.  * This structure is used for passing arguments to external programs.
  101.  * It is usually passed as an "argstring", a pointer to the string buffer.
  102. }
  103.  
  104. Type
  105.  
  106.     pRexxArg = ^tRexxArg;
  107.     tRexxArg = record
  108.     ra_Size     : Longint;  { total allocated length        }
  109.     ra_Length   : Word;     { length of string              }
  110.     ra_Flags    : Byte;     { attribute flags               }
  111.     ra_Hash     : Byte;     { hash code                     }
  112.     ra_Buff     : Array [0..7] of Byte;
  113.                     { buffer area                   }
  114.     end;                { size: 16 bytes (minimum)      }
  115.  
  116. { The RexxMsg structure is used for all communications with REXX
  117.  * programs.  It is an EXEC message with a parameter block appended.
  118. }
  119.  
  120.     pRexxMsg = ^tRexxMsg;
  121.     tRexxMsg = record
  122.     rm_Node     : tMessage;  { EXEC message structure        }
  123.     rm_TaskBlock    : Pointer;  { global structure (private)    }
  124.     rm_LibBase  : Pointer;  { library base (private)        }
  125.     rm_Action   : Longint;  { command (action) code         }
  126.     rm_Result1  : Longint;  { primary result (return code)  }
  127.     rm_Result2  : Longint;  { secondary result              }
  128.     rm_Args     : Array [0..15] of STRPTR;
  129.                     { argument block (ARG0-ARG15)   }
  130.  
  131.     rm_PassPort : pMsgPort;   { forwarding port               }
  132.     rm_CommAddr : STRPTR;   { host address (port name)      }
  133.     rm_FileExt  : STRPTR;   { file extension                }
  134.     rm_Stdin    : Longint;  { input stream (filehandle)     }
  135.     rm_Stdout   : Longint;  { output stream (filehandle)    }
  136.     rm_avail    : Longint;  { future expansion              }
  137.     end;                { size: 128 bytes               }
  138.  
  139. Const
  140.  
  141.     MAXRMARG        = 15;       { maximum arguments             }
  142.  
  143. { Command (action) codes for message packets                           }
  144.  
  145.     RXCOMM      = $01000000;    { a command-level invocation    }
  146.     RXFUNC      = $02000000;    { a function call               }
  147.     RXCLOSE     = $03000000;    { close the REXX server         }
  148.     RXQUERY     = $04000000;    { query for information         }
  149.     RXADDFH     = $07000000;    { add a function host           }
  150.     RXADDLIB        = $08000000;    { add a function library        }
  151.     RXREMLIB        = $09000000;    { remove a function library     }
  152.     RXADDCON        = $0A000000;    { add/update a ClipList string  }
  153.     RXREMCON        = $0B000000;    { remove a ClipList string      }
  154.     RXTCOPN     = $0C000000;    { open the trace console        }
  155.     RXTCCLS     = $0D000000;    { close the trace console       }
  156.  
  157. { Command modifier flag bits                                           }
  158.  
  159.     RXFB_NOIO       = 16;       { suppress I/O inheritance?     }
  160.     RXFB_RESULT     = 17;       { result string expected?       }
  161.     RXFB_STRING     = 18;       { program is a "string file"?   }
  162.     RXFB_TOKEN      = 19;       { tokenize the command line?    }
  163.     RXFB_NONRET     = 20;       { a "no-return" message?        }
  164.  
  165. { The flag form of the command modifiers                               }
  166.  
  167.     RXFF_NOIO       = $00010000;
  168.     RXFF_RESULT     = $00020000;
  169.     RXFF_STRING     = $00040000;
  170.     RXFF_TOKEN      = $00080000;
  171.     RXFF_NONRET     = $00100000;
  172.  
  173.     RXCODEMASK      = $FF000000;
  174.     RXARGMASK       = $0000000F;
  175.  
  176. { The RexxRsrc structure is used to manage global resources.  Each node 
  177.  * has a name string created as a RexxArg structure, and the total size
  178.  * of the node is saved in the "rr_Size" field.  The REXX systems library
  179.  * provides functions to allocate and release resource nodes.  If special
  180.  * deletion operations are required, an offset and base can be provided in
  181.  * "rr_Func" and "rr_Base", respectively.  This "autodelete" function will
  182.  * be called with the base in register A6 and the node in A0.
  183.  }
  184.  
  185. Type
  186.  
  187.     pRexxRsrc = ^tRexxRsrc;
  188.     tRexxRsrc = record
  189.     rr_Node     : tNode;
  190.     rr_Func     : Integer;    { "auto-delete" offset          }
  191.     rr_Base     : Pointer;  { "auto-delete" base            }
  192.     rr_Size     : Longint;  { total size of node            }
  193.     rr_Arg1     : Longint;  { available ...                 }
  194.     rr_Arg2     : Longint;  { available ...                 }
  195.     end;                { size: 32 bytes                }
  196.  
  197. Const
  198.  
  199. { Resource node types                                                  }
  200.  
  201.     RRT_ANY     = 0;        { any node type ...             }
  202.     RRT_LIB     = 1;        { a function library            }
  203.     RRT_PORT        = 2;        { a public port                 }
  204.     RRT_FILE        = 3;        { a file IoBuff                 }
  205.     RRT_HOST        = 4;        { a function host               }
  206.     RRT_CLIP        = 5;        { a Clip List node              }
  207.  
  208. { The RexxTask structure holds the fields used by REXX to communicate with
  209.  * external processes, including the client task.  It includes the global
  210.  * data structure (and the base environment).  The structure is passed to
  211.  * the newly-created task in its "wake-up" message.
  212.  }
  213.  
  214.     GLOBALSZ        = 200;      { total size of GlobalData      }
  215.  
  216. Type
  217.  
  218.     pRexxTask = ^tRexxTask;
  219.     tRexxTask = record
  220.     rt_Global   : Array [0..GLOBALSZ-1] of Byte;
  221.                     { global data structure         }
  222.     rt_MsgPort  : tMsgPort;  { global message port           }
  223.     rt_Flags    : Byte;     { task flag bits                }
  224.     rt_SigBit   : Shortint;     { signal bit                    }
  225.  
  226.     rt_ClientID : Pointer;  { the client's task ID          }
  227.     rt_MsgPkt   : Pointer;  { the packet being processed    }
  228.     rt_TaskID   : Pointer;  { our task ID                   }
  229.     rt_RexxPort : Pointer;  { the REXX public port          }
  230.  
  231.     rt_ErrTrap  : Pointer;  { Error trap address            }
  232.     rt_StackPtr : Pointer;  { stack pointer for traps       }
  233.  
  234.     rt_Header1  : tList;     { Environment list              }
  235.     rt_Header2  : tList;     { Memory freelist               }
  236.     rt_Header3  : tList;     { Memory allocation list        }
  237.     rt_Header4  : tList;     { Files list                    }
  238.     rt_Header5  : tList;     { Message Ports List            }
  239.     end;
  240.  
  241. Const
  242.  
  243. { Definitions for RexxTask flag bits                                   }
  244.  
  245.     RTFB_TRACE      = 0;        { external trace flag           }
  246.     RTFB_HALT       = 1;        { external halt flag            }
  247.     RTFB_SUSP       = 2;        { suspend task?                 }
  248.     RTFB_TCUSE      = 3;        { trace console in use?         }
  249.     RTFB_WAIT       = 6;        { waiting for reply?            }
  250.     RTFB_CLOSE      = 7;        { task completed?               }
  251.  
  252. { Definitions for memory allocation constants                          }
  253.  
  254.     MEMQUANT        = 16;       { quantum of memory space       }
  255.     MEMMASK     = $FFFFFFF0;    { mask for rounding the size    }
  256.  
  257.     MEMQUICK        = 1;        { EXEC flags: MEMF_PUBLIC       }
  258.     MEMCLEAR        = $00010000;    { EXEC flags: MEMF_CLEAR        }
  259.  
  260. { The SrcNode is a temporary structure used to hold values destined for
  261.  * a segment array.  It is also used to maintain the memory freelist.
  262. }
  263.  
  264. Type
  265.  
  266.     pSrcNode = ^tSrcNode;
  267.     tSrcNode = record
  268.     sn_Succ     : pSrcNode; { next node                     }
  269.     sn_Pred     : pSrcNode; { previous node                 }
  270.     sn_Ptr      : Pointer;  { pointer value                 }
  271.     sn_Size     : Longint;  { size of object                }
  272.     end;                { size: 16 bytes                }
  273.  
  274. { === rexx/rexxio.h ====================================================
  275.  *
  276.  * Copyright (c) 1986, 1987 by William S. Hawes.  All Rights Reserved.
  277.  *
  278.  * ======================================================================
  279.  * Header file for ARexx Input/Output related structures
  280. }
  281.  
  282. Const
  283.  
  284.     RXBUFFSZ    = 204;          { buffer length                 }
  285.  
  286. {
  287.  * The IoBuff is a resource node used to maintain the File List.  Nodes
  288.  * are allocated and linked into the list whenever a file is opened.
  289. }
  290.  
  291. Type
  292.  
  293.     pIoBuff = ^tIoBuff;
  294.     tIoBuff = record
  295.     iobNode     : tRexxRsrc; { structure for files/strings   }
  296.     iobRpt      : Pointer;  { read/write pointer            }
  297.     iobRct      : Longint;  { character count               }
  298.     iobDFH      : Longint;  { DOS filehandle                }
  299.     iobLock     : Longint;  { DOS lock                      }
  300.     iobBct      : Longint;  { buffer length                 }
  301.     iobArea     : Array [0..RXBUFFSZ-1] of Byte;
  302.                     { buffer area                   }
  303.     end;                { size: 256 bytes               }
  304.  
  305. Const
  306.  
  307. { Access mode definitions                                              }
  308.  
  309.     RXIO_EXIST      = -1;       { an external filehandle        }
  310.     RXIO_STRF       = 0;        { a "string file"               }
  311.     RXIO_READ       = 1;        { read-only access              }
  312.     RXIO_WRITE      = 2;        { write mode                    }
  313.     RXIO_APPEND     = 3;        { append mode (existing file)   }
  314.  
  315. {
  316.  * Offset anchors for SeekF()
  317. }
  318.  
  319.     RXIO_BEGIN      = -1;       { relative to start             }
  320.     RXIO_CURR       = 0;        { relative to current position  }
  321.     RXIO_END        = 1;        { relative to end               }
  322.  
  323. {
  324.  * A message port structure, maintained as a resource node.  The ReplyList
  325.  * holds packets that have been received but haven't been replied.
  326. }
  327.  
  328. Type
  329.  
  330.     pRexxMsgPort = ^tRexxMsgPort;
  331.     tRexxMsgPort = record
  332.     rmp_Node    : tRexxRsrc; { linkage node                  }
  333.     rmp_Port    : tMsgPort;  { the message port              }
  334.     rmp_ReplyList   : tList;     { messages awaiting reply       }
  335.     end;
  336.  
  337. Const
  338.  
  339. {
  340.  * DOS Device types
  341. }
  342.  
  343.     DT_DEV  = 0;            { a device                      }
  344.     DT_DIR  = 1;            { an ASSIGNed directory         }
  345.     DT_VOL  = 2;            { a volume                      }
  346.  
  347. {
  348.  * Private DOS packet types
  349. }
  350.  
  351.     ACTION_STACK    = 2002;     { stack a line                  }
  352.     ACTION_QUEUE    = 2003;     { queue a line                  }
  353.  
  354. { === rexx/rxslib.h ===================================================
  355.  *
  356.  * Copyright (c) 1986, 1987, 1989 by William S. Hawes (All Rights Reserved)
  357.  *
  358.  * =====================================================================
  359.  * The header file for the REXX Systems Library
  360. }
  361.  
  362. { Some macro definitions                                               }
  363.  
  364. Const
  365.  
  366.     RXSNAME    : PChar = 'rexxsyslib.library';
  367.     RXSID      : PChar = 'rexxsyslib 1.06 (07 MAR 88)';
  368.     RXSDIR     : PChar = 'REXX';
  369.     RXSTNAME   : PChar = 'ARexx';
  370.  
  371. { The REXX systems library structure.  This should be considered as    }
  372. { semi-private and read-only, except for documented exceptions.        }
  373.  
  374. Type
  375.  
  376.     pRxsLib = ^tRxsLib;
  377.     tRxsLib = record
  378.     rl_Node     : tLibrary;  { EXEC library node             }
  379.     rl_Flags    : Byte;     { global flags                  }
  380.     rl_pad      : Byte;
  381.     rl_SysBase  : Pointer;  { EXEC library base             }
  382.     rl_DOSBase  : Pointer;  { DOS library base              }
  383.     rl_IeeeDPBase   : Pointer;  { IEEE DP math library base     }
  384.     rl_SegList  : Longint;  { library seglist               }
  385.     rl_NIL      : Longint;  { global NIL: filehandle        }
  386.     rl_Chunk    : Longint;  { allocation quantum            }
  387.     rl_MaxNest  : Longint;  { maximum expression nesting    }
  388.     rl_NULL     : pNexxStr;   { static string: NULL           }
  389.     rl_FALSE    : pNexxStr;   { static string: FALSE          }
  390.     rl_TRUE     : pNexxStr;   { static string: TRUE           }
  391.     rl_REXX     : pNexxStr;   { static string: REXX           }
  392.     rl_COMMAND  : pNexxStr;   { static string: COMMAND        }
  393.     rl_STDIN    : pNexxStr;   { static string: STDIN          }
  394.     rl_STDOUT   : pNexxStr;   { static string: STDOUT         }
  395.     rl_STDERR   : pNexxStr;   { static string: STDERR         }
  396.     rl_Version  : STRPTR;   { version/configuration string  }
  397.  
  398.     rl_TaskName : STRPTR;   { name string for tasks         }
  399.     rl_TaskPri  : Longint;  { starting priority             }
  400.     rl_TaskSeg  : Longint;  { startup seglist               }
  401.     rl_StackSize    : Longint;  { stack size                    }
  402.     rl_RexxDir  : STRPTR;   { REXX directory                }
  403.     rl_CTABLE   : STRPTR;   { character attribute table     }
  404.     rl_Notice   : STRPTR;   { copyright notice              }
  405.  
  406.     rl_RexxPort : tMsgPort;  { REXX public port              }
  407.     rl_ReadLock : Word;    { lock count                    }
  408.     rl_TraceFH  : Longint;  { global trace console          }
  409.     rl_TaskList : tList;     { REXX task list                }
  410.     rl_NumTask  : Integer;    { task count                    }
  411.     rl_LibList  : tList;     { Library List header           }
  412.     rl_NumLib   : Integer;    { library count                 }
  413.     rl_ClipList : tList;     { ClipList header               }
  414.     rl_NumClip  : Integer;    { clip node count               }
  415.     rl_MsgList  : tList;     { pending messages              }
  416.     rl_NumMsg   : Integer;    { pending count                 }
  417.     rl_PgmList  : tList;     { cached programs               }
  418.     rl_NumPgm   : Integer;    { program count                 }
  419.  
  420.     rl_TraceCnt : Word;    { usage count for trace console }
  421.     rl_avail    : Integer;
  422.     end;
  423.  
  424. Const
  425.  
  426. { Global flag bit definitions for RexxMaster                           }
  427.     RLFB_TRACE  = RTFB_TRACE;       { interactive tracing?          }
  428.     RLFB_HALT   = RTFB_HALT;        { halt execution?               }
  429.     RLFB_SUSP   = RTFB_SUSP;        { suspend execution?            }
  430.     RLFB_STOP   = 6;            { deny further invocations      }
  431.     RLFB_CLOSE  = 7;            { close the master              }
  432.  
  433.     RLFMASK = 1 + 2 + 4;
  434.  
  435. { Initialization constants                                             }
  436.  
  437.     RXSVERS = 34;           { main version                  }
  438.     RXSREV  = 7;            { revision                      }
  439.     RXSALLOC    = $800000;      { maximum allocation            }
  440.     RXSCHUNK    = 1024;         { allocation quantum            }
  441.     RXSNEST = 32;           { expression nesting limit      }
  442.     RXSTPRI = 0;            { task priority                 }
  443.     RXSSTACK    = 4096;         { stack size                    }
  444.     RXSLISTH    = 5;            { number of list headers        }
  445.  
  446. { Character attribute flag bits used in REXX.                          }
  447.  
  448.     CTB_SPACE   = 0;            { white space characters        }
  449.     CTB_DIGIT   = 1;            { decimal digits 0-9            }
  450.     CTB_ALPHA   = 2;            { alphabetic characters         }
  451.     CTB_REXXSYM = 3;            { REXX symbol characters        }
  452.     CTB_REXXOPR = 4;            { REXX operator characters      }
  453.     CTB_REXXSPC = 5;            { REXX special symbols          }
  454.     CTB_UPPER   = 6;            { UPPERCASE alphabetic          }
  455.     CTB_LOWER   = 7;            { lowercase alphabetic          }
  456.                                                                       
  457. { Attribute flags                                                      }
  458.  
  459.     CTF_SPACE   = 1;
  460.     CTF_DIGIT   = 2;
  461.     CTF_ALPHA   = 4;
  462.     CTF_REXXSYM = 8;
  463.     CTF_REXXOPR = 16;
  464.     CTF_REXXSPC = 32;
  465.     CTF_UPPER   = 64;
  466.     CTF_LOWER   = 128;
  467.  
  468.  
  469. VAR RexxSysBase : pLibrary;
  470.  
  471. PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
  472. FUNCTION CreateArgstring(argstring : pCHAR; length : ULONG) : pCHAR;
  473. FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : pCHAR) : pRexxMsg;
  474. PROCEDURE DeleteArgstring(argstring : pCHAR);
  475. PROCEDURE DeleteRexxMsg(packet : pRexxMsg);
  476. FUNCTION FillRexxMsg(msgptr : pRexxMsg; count : ULONG; mask : ULONG) : BOOLEAN;
  477. FUNCTION IsRexxMsg(msgptr : pRexxMsg) : BOOLEAN;
  478. FUNCTION LengthArgstring(argstring : pCHAR) : ULONG;
  479. PROCEDURE LockRexxBase(resource : ULONG);
  480. PROCEDURE UnlockRexxBase(resource : ULONG);
  481.  
  482. {$ifdef amiga_overlays}
  483.  
  484. FUNCTION CreateArgstring(argstring : string; length : ULONG) : pCHAR;
  485. FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : pCHAR) : pRexxMsg;
  486. FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : string) : pRexxMsg;
  487. FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : string) : pRexxMsg;
  488. PROCEDURE DeleteArgstring(argstring : string);
  489. FUNCTION LengthArgstring(argstring : string) : ULONG;
  490.  
  491. {$endif}
  492.  
  493. IMPLEMENTATION
  494.  
  495. {$ifdef amiga_overlays}
  496. uses pastoc;
  497. {$endif}
  498.  
  499.  
  500. PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
  501. BEGIN
  502.   ASM
  503.     MOVE.L  A6,-(A7)
  504.     MOVEA.L msgptr,A0
  505.     MOVE.L  count,D0
  506.     MOVEA.L RexxSysBase,A6
  507.     JSR -156(A6)
  508.     MOVEA.L (A7)+,A6
  509.   END;
  510. END;
  511.  
  512. FUNCTION CreateArgstring(argstring : pCHAR; length : ULONG) : pCHAR;
  513. BEGIN
  514.   ASM
  515.     MOVE.L  A6,-(A7)
  516.     MOVEA.L argstring,A0
  517.     MOVE.L  length,D0
  518.     MOVEA.L RexxSysBase,A6
  519.     JSR -126(A6)
  520.     MOVEA.L (A7)+,A6
  521.     MOVE.L  D0,@RESULT
  522.   END;
  523. END;
  524.  
  525. FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : pCHAR) : pRexxMsg;
  526. BEGIN
  527.   ASM
  528.     MOVE.L  A6,-(A7)
  529.     MOVEA.L port,A0
  530.     MOVEA.L extension,A1
  531.     MOVE.L  host,D0
  532.     MOVEA.L RexxSysBase,A6
  533.     JSR -144(A6)
  534.     MOVEA.L (A7)+,A6
  535.     MOVE.L  D0,@RESULT
  536.   END;
  537. END;
  538.  
  539. PROCEDURE DeleteArgstring(argstring : pCHAR);
  540. BEGIN
  541.   ASM
  542.     MOVE.L  A6,-(A7)
  543.     MOVEA.L argstring,A0
  544.     MOVEA.L RexxSysBase,A6
  545.     JSR -132(A6)
  546.     MOVEA.L (A7)+,A6
  547.   END;
  548. END;
  549.  
  550. PROCEDURE DeleteRexxMsg(packet : pRexxMsg);
  551. BEGIN
  552.   ASM
  553.     MOVE.L  A6,-(A7)
  554.     MOVEA.L packet,A0
  555.     MOVEA.L RexxSysBase,A6
  556.     JSR -150(A6)
  557.     MOVEA.L (A7)+,A6
  558.   END;
  559. END;
  560.  
  561. FUNCTION FillRexxMsg(msgptr : pRexxMsg; count : ULONG; mask : ULONG) : BOOLEAN;
  562. BEGIN
  563.   ASM
  564.     MOVE.L  A6,-(A7)
  565.     MOVEA.L msgptr,A0
  566.     MOVE.L  count,D0
  567.     MOVE.L  mask,D1
  568.     MOVEA.L RexxSysBase,A6
  569.     JSR -162(A6)
  570.     MOVEA.L (A7)+,A6
  571.     TST.W   D0
  572.     BEQ.B   @end
  573.     MOVEQ   #1,D0
  574.   @end: MOVE.B  D0,@RESULT
  575.   END;
  576. END;
  577.  
  578. FUNCTION IsRexxMsg(msgptr : pRexxMsg) : BOOLEAN;
  579. BEGIN
  580.   ASM
  581.     MOVE.L  A6,-(A7)
  582.     MOVEA.L msgptr,A0
  583.     MOVEA.L RexxSysBase,A6
  584.     JSR -168(A6)
  585.     MOVEA.L (A7)+,A6
  586.     TST.W   D0
  587.     BEQ.B   @end
  588.     MOVEQ   #1,D0
  589.   @end: MOVE.B  D0,@RESULT
  590.   END;
  591. END;
  592.  
  593. FUNCTION LengthArgstring(argstring : pCHAR) : ULONG;
  594. BEGIN
  595.   ASM
  596.     MOVE.L  A6,-(A7)
  597.     MOVEA.L argstring,A0
  598.     MOVEA.L RexxSysBase,A6
  599.     JSR -138(A6)
  600.     MOVEA.L (A7)+,A6
  601.     MOVE.L  D0,@RESULT
  602.   END;
  603. END;
  604.  
  605. PROCEDURE LockRexxBase(resource : ULONG);
  606. BEGIN
  607.   ASM
  608.     MOVE.L  A6,-(A7)
  609.     MOVE.L  resource,D0
  610.     MOVEA.L RexxSysBase,A6
  611.     JSR -450(A6)
  612.     MOVEA.L (A7)+,A6
  613.   END;
  614. END;
  615.  
  616. PROCEDURE UnlockRexxBase(resource : ULONG);
  617. BEGIN
  618.   ASM
  619.     MOVE.L  A6,-(A7)
  620.     MOVE.L  resource,D0
  621.     MOVEA.L RexxSysBase,A6
  622.     JSR -456(A6)
  623.     MOVEA.L (A7)+,A6
  624.   END;
  625. END;
  626.  
  627. {$ifdef amiga_overlays}
  628.  
  629. FUNCTION CreateArgstring(argstring : string; length : ULONG) : pCHAR;
  630. begin
  631.        CreateArgstring := CreateArgstring(pas2c(argstring),length);
  632. end;
  633.  
  634. FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : pCHAR) : pRexxMsg;
  635. begin
  636.        CreateRexxMsg := CreateRexxMsg(port,pas2c(extension),host);
  637. end;
  638.  
  639. FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : string) : pRexxMsg;
  640. begin
  641.        CreateRexxMsg := CreateRexxMsg(port,extension,pas2c(host));
  642. end;
  643.  
  644. FUNCTION CreateRexxMsg(port : pMsgPort; extension : string; host : string) : pRexxMsg;
  645. begin
  646.        CreateRexxMsg := CreateRexxMsg(port,pas2c(extension),pas2c(host));
  647. end;
  648.  
  649. PROCEDURE DeleteArgstring(argstring : string);
  650. begin
  651.        DeleteArgstring(pas2c(argstring));
  652. end;
  653.  
  654. FUNCTION LengthArgstring(argstring : string) : ULONG;
  655. begin
  656.        LengthArgstring := LengthArgstring(pas2c(argstring));
  657. end;
  658.  
  659. {$endif}
  660.  
  661. END. (* UNIT REXXSYSLIB *)
  662.